<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			window.onload = function()
			{
				let ip = document.querySelector('input');
				let btn  = document.querySelector('button');
				btn.onclick = function()
				{
					let text = ip.value;
					
					if(text.slice(0 , 1) == '京')
					{
						ip.value = text.toUpperCase();
					}
					else
					{
						alert('非北京车辆禁止进入');
					}
				}
					
			}
		</script>
	</head>
	<body>
		<span>车牌号</span>
		<input type="text" />
		<button>按钮</button>
	</body>
</html>